import 'package:equatable/equatable.dart';
import 'package:backend.core/core/domain/entities/api/app_store/api_app_store_purchased_subscription_price_increase_status.dart';

const kApiAppStoreAbsentPurchasedSubscriptionPriceIncreaseStatusValue = 'absent';
const kApiAppStorePendingPurchasedSubscriptionPriceIncreaseStatusValue = 'pending';
const kApiAppStoreAcceptedPurchasedSubscriptionPriceIncreaseStatusValue = 'accepted';

class ApiAppStorePurchasedSubscriptionPriceIncreaseStatusDto extends Equatable {
  const ApiAppStorePurchasedSubscriptionPriceIncreaseStatusDto._internal({
    required this.priceIncreaseStatusString,
  });

  final String priceIncreaseStatusString;

  @override
  List<Object?> get props {
    return [
      priceIncreaseStatusString,
    ];
  }

  factory ApiAppStorePurchasedSubscriptionPriceIncreaseStatusDto.fromEntity(
      ApiAppStorePurchasedSubscriptionPriceIncreaseStatus priceIncreaseStatus) {
    late final String priceIncreaseStatusString;

    if (priceIncreaseStatus == ApiAppStorePurchasedSubscriptionPriceIncreaseStatus.absent) {
      priceIncreaseStatusString = kApiAppStoreAbsentPurchasedSubscriptionPriceIncreaseStatusValue;
    } else if (priceIncreaseStatus == ApiAppStorePurchasedSubscriptionPriceIncreaseStatus.pending) {
      priceIncreaseStatusString = kApiAppStorePendingPurchasedSubscriptionPriceIncreaseStatusValue;
    } else if (priceIncreaseStatus ==
        ApiAppStorePurchasedSubscriptionPriceIncreaseStatus.accepted) {
      priceIncreaseStatusString = kApiAppStoreAcceptedPurchasedSubscriptionPriceIncreaseStatusValue;
    }

    return ApiAppStorePurchasedSubscriptionPriceIncreaseStatusDto._internal(
      priceIncreaseStatusString: priceIncreaseStatusString,
    );
  }

  @override
  String toString() {
    return priceIncreaseStatusString;
  }
}
